home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office deutch / INFOPATH.NL-NL / INFLR.CAB / STATRPT.XSN_1043 / agg.xsl next >
Extensible Markup Language  |  2006-11-12  |  4KB  |  97 lines

  1. ∩╗┐<?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" 
  3.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4.     xmlns:agg="http://schemas.microsoft.com/office/infopath/2003/aggregation"
  5.     xmlns:target="http://schemas.microsoft.com/office/infopath/2003/aggregation-target"
  6.     xmlns:sr="http://schemas.microsoft.com/office/infopath/2003/sample/StatusReport">
  7.  
  8.     <xsl:output method="xml" encoding="utf-8"/>
  9.     
  10.     <xsl:variable name="target" select="target:get-documentElement()"/>
  11.     
  12.     <xsl:variable name="fullName" select="normalize-space(/sr:statusReport/sr:employee/sr:name/sr:singleName)"/>
  13.     <xsl:variable name="fullNameWithBrackets">
  14.         <xsl:if test="$fullName!=''">[<xsl:value-of select="$fullName"/>]</xsl:if>
  15.     </xsl:variable>
  16.  
  17.     <xsl:template match="text()"/>
  18.     <xsl:template match="@* | node()">
  19.         <xsl:copy>
  20.             <xsl:apply-templates select="@* | node()"/>
  21.         </xsl:copy>
  22.     </xsl:template>
  23.     
  24.     <xsl:template match="/sr:statusReport">
  25.         <sr:statusReport
  26.             xmlns:agg="http://schemas.microsoft.com/office/infopath/2003/aggregation"
  27.             xmlns:target="http://schemas.microsoft.com/office/infopath/2003/aggregation-target"
  28.             xmlns:sr="http://schemas.microsoft.com/office/infopath/2003/sample/StatusReport">
  29.                 <xsl:apply-templates select="sr:summary"/>
  30.                 <xsl:apply-templates select="sr:lastPeriod"/>
  31.                 <xsl:apply-templates select="sr:thisPeriod"/>
  32.                 <xsl:apply-templates select="sr:issues"/>
  33.                 <xsl:apply-templates select="sr:notes"/>
  34.                 <xsl:apply-templates select="sr:timeReport"/>
  35.                 <xsl:apply-templates select="sr:budgetReport"/>
  36.                 <xsl:apply-templates select="sr:taskList"/>
  37.         </sr:statusReport>
  38.     </xsl:template>
  39.  
  40.     <xsl:template match="sr:item/sr:description">
  41.             <xsl:copy>
  42.                     <xsl:if test="$fullName!=''">
  43.                         <xsl:value-of select="$fullNameWithBrackets"/>
  44.                         <xsl:text> </xsl:text>
  45.                     </xsl:if>
  46.                     <xsl:copy-of select="node()"/>
  47.             </xsl:copy>
  48.     </xsl:template>
  49.  
  50.     <xsl:template match="sr:lastPeriod/sr:item|sr:thisPeriod/sr:item|sr:issues/sr:item">
  51.         <xsl:if test="normalize-space(.)!=''">
  52.             <xsl:copy>
  53.                 <xsl:if test="$fullName!=''">
  54.                     <xsl:value-of select="$fullNameWithBrackets"/>
  55.                     <xsl:text> </xsl:text>
  56.                 </xsl:if>
  57.                 <xsl:copy-of select="node()"/>
  58.             </xsl:copy>
  59.         </xsl:if>
  60.     </xsl:template>
  61.     
  62.     <xsl:template match="/sr:statusReport/sr:summary">
  63.         <xsl:call-template name="replace-rich-text-node">
  64.             <xsl:with-param name="original-node" select="$target/sr:summary"/>
  65.         </xsl:call-template>
  66.     </xsl:template>
  67.  
  68.     <xsl:template match="/sr:statusReport/sr:notes">
  69.         <xsl:call-template name="replace-rich-text-node">
  70.             <xsl:with-param name="original-node" select="$target/sr:notes"/>
  71.         </xsl:call-template>
  72.     </xsl:template>
  73.  
  74.     <xsl:template name="replace-rich-text-node">
  75.         <xsl:param name="original-node"/>
  76.         <xsl:if test="normalize-space(.)!=''">
  77.             <xsl:copy>
  78.                 <xsl:apply-templates select="@*"/>
  79.                 <xsl:attribute name="agg:action">replace</xsl:attribute>
  80.                 <xsl:copy-of select="$original-node/node()"/>
  81.                 <xsl:if test="$fullName!=''">
  82.                     <div xmlns="http://www.w3.org/1999/xhtml">
  83.                         <strong>
  84.                                 <xsl:value-of select="$fullName"/>
  85.                                 <xsl:text>:</xsl:text>
  86.                         </strong>
  87.                     </div>
  88.                 </xsl:if>
  89.                 <blockquote xmlns="http://www.w3.org/1999/xhtml" dir="ltr" style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; MARGIN-RIGHT:0px">
  90.                     <xsl:copy-of select="node()"/>
  91.                 </blockquote>
  92.             </xsl:copy>
  93.         </xsl:if>            
  94.     </xsl:template>
  95. </xsl:stylesheet>
  96.  
  97.